package com.usian.admin.controller;

import com.usian.admin.service.AdSensitiveService;
import com.usian.api.admin.AdSensitiveControllerApi;
import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 敏感词管理模块
 */
@RestController
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController implements AdSensitiveControllerApi {
    @Autowired
    AdSensitiveService adSensitiveService;

    /**
     * 查询
     *
     * @param dto
     * @return
     */
    @RequestMapping("/list")
    @Override
    public ResponseResult findByPage(@RequestBody SensitiveDto dto) {
        return adSensitiveService.findByPage(dto);
    }

    /**
     * 插入数据
     *
     * @param adSensitive
     * @return
     */
    @PostMapping("/save")
    @Override
    public ResponseResult save(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.insert(adSensitive);
    }

    @PostMapping("/update")
    @Override
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.updates(adSensitive);
    }

    @DeleteMapping("/del/{id}")
    @Override
    public ResponseResult del(@PathVariable("id") Integer id) {
        return adSensitiveService.del(id);
    }

}
